// 角色管理
import {request} from '@/utils/request'
import type {  Roles, RoleObj, RolesParams, AddRoleParams } from '@/types/setting'
import type { CompanyInfo } from '@/types/company';

// 获取角色列表
export const getRoleListApi = (params: RolesParams) => {
  return request<RoleObj>('/sys/role', 'GET', params)
}

// 新增角色
export const addRoleApi = (data: AddRoleParams) => {
  return request('/sys/role', 'POST', data)
}

// 删除角色
export const deleteRoleApi = (id: string) => {
  return request(`/sys/role/${id}`, 'DELETE')
}

// 根据id获取角色详情
export const getRoleDetailApi = (id: string) => {
  return request<Roles>(`/sys/role/${id}`, 'GET')
}

// 更新角色
export const updateRoleApi = (data: Roles) => {
  return request(`/sys/role/${data.id}`, 'PUT', data)
}

// 获取公司信息
export const getCompanyInfoApi = (id: string) => {
  return request<CompanyInfo>(`/company/${id}`, 'get')
}

